﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sunimage.Spjg.Common
{
    public class FilterStrHelper
    {
        /// <summary>
        /// 过滤查询条件里的特殊字符
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string FilterSearchStr(string theString)
        {
            theString = theString.Replace("'", "''");
            return theString;

        }
        /// <summary>
        /// 处理批次的显示格式
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static string DealBatch(object obj)
        {
            if (obj != null&&!string.IsNullOrEmpty(obj.ToString()))
                return Convert.ToDateTime(obj).ToString("yyyy-MM-dd");
            return "";
        }
        /// <summary>
        /// 处理日期格式
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static string DealDate(object obj)
        {
            if (obj != null)
                return Convert.ToDateTime(obj).ToString("yyyy-MM-dd HH:mm:ss");
            return "";
        }
    }
}
